<%@ page import="vy.org.app.common.*" %>
<%@ page import="org.vy.dal.dao.VyAshramDO" %>
<%@ page import="java.util.*" %>

<%!
	private static final ResourceBundle RESOURCE = ResourceBundle.getBundle("LabelResource");
	private static final String EMPTY = "&nbsp;";
	private UserCtx m_user;
%>

<%
	m_user = ActionCtx.ctx(request).getUser();
	List<VyAshramDO> results = (List<VyAshramDO>)request.getAttribute(AppConstants.RESULT);
	boolean canAdd = m_user.hasAccessToModule(ModuleEnum.ADD_ASHRAM.getId().toString());
  	boolean canDelete = m_user.hasAccessToModule(ModuleEnum.DELETE_ASHRAM.getId().toString());
  	boolean canEdit = m_user.hasAccessToModule(ModuleEnum.EDIT_ASHRAM.getId().toString());
	
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<head>
	<link rel="stylesheet" type="text/css" href="./css/Common.css">
	<script type="text/javascript" src="./scripts/Common.js"></script>
	<style>
		body {color:#222; font-size:12px; font-family:Arial, Helvetica, sans-serif}
		.rst-panel{color:#222; font-size:12px; font-family:Arial, Helvetica, sans-serif;
			overflow:auto;height:300px;margin:0 10px;clear:both;border:1px solid #ccc;}
		table.qry td {padding-right:5px;}
		table.qry td input[type='text']{height:18px;}
		table.qry td select {height:24px;}
		table.rst th{background-color:#F0E7DD;text-align:left; border:1px solid #fff;padding:4px 8px;white-space:nowrap;}
		table.rst tr td {border:1px solid #fff;padding:3px 5px;white-space:nowrap;}	
		table.rst tr.alt td {background-color:#EBEBEB;padding:3px 5px;border:1px solid #fff;white-space:nowrap;}
		a.abtn{float:left;margin-bottom:10px;padding:5px 15px;margin-right:10px;color:#fff;text-decoration:none;background:transparent url(./pages/images/strip_gray.png) repeat-x scroll left top;}
		a.abtn:hover{background:#719392;}
		.abtn-cnt {padding-left:10px;padding-top:5px;}
		.btn {padding:2px 5px;}
	</style>
</head> 
<body> 
<form name="mntnAshramForm" id="mntnAshramForm" method=post Action="./mntnashram.do">
	<input type="hidden" name="mode" id="mode" value="SEARCH">
  <table class="qry" width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
    <tr>
      <td width="1%"></td>
      <td><center><img src="./pages/image_gif/mf1.gif" width="861" height="48"></center></td>
      <td width="1%"></td>
    </tr>
    <tr>
      <td align="right" valign="middle" width="3" ></td>
      <td width="850px"  align="left" valign="top">
      	<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
          <tr>
            <td height="24" colspan="4">
            	<table width="100%" border="0" cellpadding="0" cellspacing="0">
            	<tr>
              		<td height="22"><img src="./pages/image_gif/search_mem.gif" alt="" name="off_add" width="861" height="22" border="0" ></td>
              	</tr>
            	</table>
            </td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><strong><%=RESOURCE.getString("ashram.ASHRAM_CODE") %></strong> &nbsp;</div></td>
            <td width="30%"><input name="ashramcode" type="text" class="textBoxDashed" id="ashramcode" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.ASHRAM_NAME") %></div></td>
            <td width="30%"><input name="ashramName" type="text" class="textBoxDashed" id="ashramName" size="33" maxlength="15"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.ASHRAM_ADDRESS_ID") %> &nbsp;</div></td>
            <td width="30%"><input name="ashramAddress" type="text" class="textBoxDashed" id="ashramAddress" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.ASHRAM_CONTACT_NO") %></div></td>
            <td width="30%"><input name="ashramContactNo" type="text" class="textBoxDashed" id="ashramContactNo" size="33" maxlength="15"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.EMAIL") %> &nbsp;</div></td>
            <td width="30%"><input name="email" type="text" class="textBoxDashed" id="email" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.PRIMARY_CONTACT") %></div></td>
            <td width="30%"><input name="primaryContact" type="text" class="textBoxDashed" id="primaryContact" size="33" maxlength="15"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.FAX") %> &nbsp;</div></td>
            <td width="30%"><input name="fax" type="text" class="textBoxDashed" id="fax" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.SECONDARY_CONTACT") %></div></td>
            <td width="30%"><input name="secondaryContact" type="text" class="textBoxDashed" id="secondaryContact" size="33" maxlength="15"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.START_DATE") %> &nbsp;</div></td>
            <td width="30%"><input name="startDate" type="text" class="textBoxDashed" id="startDate" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.OWN_OR_RENT") %></div></td>
            <td width="30%"><input name="ownOrRent" type="text" class="textBoxDashed" id="ownOrRent" size="33" maxlength="15"></td>
          </tr>
          
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.LAST_UPDATED_BY") %> &nbsp;</div></td>
            <td width="30%"><input name="lastUpdatedBy" type="text" class="textBoxDashed" id="lastUpdatedBy" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.LAST_UPDATED_ON") %></div></td>
            <td width="30%"><input name="lastUpdatedOn" type="text" class="textBoxDashed" id="lastUpdatedOn" size="33" maxlength="15"></td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.IS_DELETED") %> &nbsp;</div></td>
            <td width="30%"><input name="isDeleted" type="text" class="textBoxDashed" id="isDeleted" size="33" maxlength="15"></td>
            <td width="20%"><div align="right"><%=RESOURCE.getString("ashram.COMMENT") %></div></td>
            <td width="30%"><input name="comment" type="text" class="textBoxDashed" id="comment" size="33" maxlength="15"></td>
          </tr>
                                       
          <tr bgcolor="#F0E7DD">
            <td colspan="4">&nbsp;</td>
          </tr>
          <tr bgcolor="#EBEBEB">
            <td colspan="4"><div align="center">
                <input type="reset" name="Clear" value="  <%=RESOURCE.getString("CLEAR") %>  " class="btn" />
              &nbsp;&nbsp;
                <input name="submit" type="submit" value="<%=RESOURCE.getString("SEARCH") %>" class="btn"/></div></td>
          </tr>
        </table>
         </td>
      <td width="1%"></td>
    </tr>
    <tr>
      <td width="1%"></td>
    </tr>
  </table>
  
  <div class="abtn-cnt">
  <%
  	if(canAdd){
  		%><input name="add" type="submit" value="Add" class="abtn" title="Add Ashram" onclick="addForm()"></input><%
  	}
	if(canDelete){
  		%><input name="delete" type="submit" value="Delete" class="abtn" title="Delete Ashram" onclick="deleteForm()"></input><%
  	}
  %>
  </div>
  <div class="rst-panel">  
  <table class="rst" cellpadding="0" cellspacing="0" width="100%" border="0">
  	<thead>
  		<tr>
  			<th><div class="hd"><%=RESOURCE.getString("SELECT") %></div></th>
  			<th><div class="hd"><%=EMPTY %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("ashram.ASHRAM_CODE") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("ashram.ASHRAM_NAME") %></div></th>
			<th><div class="hd"><%=RESOURCE.getString("ashram.ASHRAM_ADDRESS_ID") %></div></th>
			<th><div class="hd"><%=RESOURCE.getString("ashram.ASHRAM_CONTACT_NO") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("ashram.EMAIL") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("ashram.FAX") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("ashram.PRIMARY_CONTACT") %></div></th>
			<th><div class="hd"><%=RESOURCE.getString("ashram.SECONDARY_CONTACT") %></div></th>
			<th><div class="hd"><%=RESOURCE.getString("ashram.START_DATE") %></div></th>
			<th><div class="hd"><%=RESOURCE.getString("ashram.OWN_OR_RENT") %></div></th>
			<th><div class="hd"><%=RESOURCE.getString("ashram.IS_DELETED") %></div></th>
			<th><div class="hd"><%=RESOURCE.getString("santsamaj.LAST_UPDATED_BY") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("santsamaj.LAST_UPDATED_ON") %></div></th>
  			<th><div class="hd"><%=RESOURCE.getString("santsamaj.COMMENT") %></div></th>

  			
  		</tr>
  	</thead>
  	<tbody>
  <%
  	if(results != null && !results.isEmpty()){
  		int idx=0;
  		for(VyAshramDO rec : results){
  			%><tr><%
			if(canDelete){
				%><td><input type="radio" id ="getAshramcode" name="getAshramcode" value="<%=rec.getAshramcode() %>" /></td> <%
			}else{
				%><td><%=EMPTY %></td><%
			}
			
			if(canEdit){
				%><td><a href="./mntnashram.do?mode=EDIT&ID=<%=rec.getAshramcode() %>" title="Edit" ><%=rec.getAshramcode() %></a></td><%
			}else{
				%><td><%=rec.getAshramcode() %></td><%
			}
			
			%>
			<td><%=rec.getAshramcode()!=null? rec.getAshramcode() : EMPTY %></td>
			<td><%=rec.getAshramName()!=null? rec.getAshramName() : EMPTY %></td>
			<td><%=rec.getAshramAddress()!=null? rec.getAshramAddress() : EMPTY %></td>
			<td><%=rec.getAshramContactNo()!=null? rec.getAshramContactNo() : EMPTY %></td>
			<td><%=rec.getEmail()!=null? rec.getEmail() : EMPTY %></td>
			<td><%=rec.getFax()!=null? rec.getFax() : EMPTY %></td>
			<td><%=rec.getPrimarycontact()!=null? rec.getPrimarycontact() : EMPTY %></td>
			<td><%=rec.getSecondarycontact()!=null? rec.getSecondarycontact() : EMPTY %></td>
			<td><%=rec.getStartDate()!=null? rec.getStartDate() : EMPTY %></td>
			<td><%=rec.getOwnOrRent()!=null? rec.getOwnOrRent() : EMPTY %></td>
			<td><%=rec.getIsDeleted()!=null? rec.getIsDeleted() : EMPTY %></td>
			<td><%=rec.getLastUpdatedBy()!=null? rec.getLastUpdatedBy() : EMPTY %></td>
			<td><%=rec.getLastUpdatedOn()!=null? rec.getLastUpdatedOn() : EMPTY %></td>
			<td><%=rec.getComment()!=null? rec.getComment() : EMPTY %></td>
			
			</tr>
			<%
  		}
  	}else{
  		%><tr><td colspan="15"><%=RESOURCE.getString("NO_RECORDS") %></td></tr><%
  	}
  %>
  </tbody>
  </table>
 </div>
</form>
</body>
<script language="JavaScript">
	

	function addForm() {
		var ashramModeForm = document.getElementById("mntnAshramForm");
		ashramModeForm.mode.value = 'ADD';
		alert('Successfully Inserted');
	}

	function deleteForm() {
		var ashramModeForm = document.getElementById("mntnAshramForm");
		ashramModeForm.mode.value = 'DELETE';
		var name = document.getElementById("getAshramcode");
		ashramModeForm.ashramcode.value = name.value;
		alert('Successfully Deleted');
	}
</script> 
</html>
     
      
    
